#pragma once

#include <cv.h>
#include <cvcam.h>
#include <highgui.h>

class CImageProcess
{
private:
	//bool *m_pbInitBG;
	bool m_bInitBG;
	IplConvKernel* m_pSE;
	IplImage* m_grayImage;
	IplImage* m_curImage32F;
	
	IplImage* m_bgImage32F;
	IplImage* m_binImage;
	IplImage* m_tempI;
	IplImage* m_bgImage3Ch;

	IplImage* m_bgStdHImage32F;
	IplImage* m_bgStdSImage32F;
	IplImage* m_bgStdVImage32F;
	
	IplImage* m_bgDevHImage32F;
	IplImage* m_bgDevSImage32F;
	IplImage* m_bgDevVImage32F;
	
	int m_stableCnt;

public:
	CImageProcess(void);
	~CImageProcess(void);

	//void SetInitBG(bool* pbInitBG_);
	IplImage* m_bgImage;

	IplImage* GetGrayImage(void){ return m_grayImage;}
	//void Init(void);
	void CImageProcess::Init(int width, int height);
	int StableBG(IplImage* inputImage, IplImage* resultImage);
	void PreProcess(IplImage* inputImage, IplImage* outputImage);
	void PostProcess(IplImage* inputImage, IplImage* maskImage);

	int KernelBG(IplImage* inputImage,IplImage* hsvImage,IplImage* hImage,IplImage* sImage,IplImage* vImage, IplImage* resultImage);
	void PreProcessKernel(IplImage* inputImage, IplImage* hsvImage, IplImage* hImage, IplImage* sImage,IplImage* vImage,IplImage* outputImage);
};
